/*
 * pca9685.h
 *
 *  Created on: Oct 5, 2020
 *      Author: Gary
 */

#ifndef INC_PCA9685_H_
#define INC_PCA9685_H_

#include "main.h"
#include "i2c.h"

#define PCA9685_WRITE_ADDR				0x80
#define PCA9685_READ_ADDR					0x81

#define PCA9685_MODE1_REG					0x00
#define PCA9685_MODE2_REG					0x01
#define PCA9685_PWM_REG_OFFSET		0x06
#define PCA9685_PRESCALE_REG			0xfe

void PCA9685_Reset(void);
void PCA9685_SetSleep(uint8_t flag);
void PCA9685_SetFreq(float freq);
void PCA9685_Init(float freq);
void PCA9685_SetPWM(uint8_t channel, uint16_t on, uint16_t off);
void PCA9685_Set(uint8_t channel, float value);

#endif /* INC_PCA9685_H_ */
